﻿Public Class ReservaNegocio

    Public Function listar() As Collection
        Dim dao As New ReservaDAO
        Return dao.listar()
    End Function

    Public Function insertar(ByVal deporte As String, ByVal cantidad As Integer, ByVal fecha_reserva As String, ByVal idevento As Integer, ByVal idusuario As Integer
                             ) As Reserva

        Dim modelo As New Reserva()
        modelo.deporte = deporte
        modelo.cantidad = cantidad
        modelo.fecha_reserva = fecha_reserva
        modelo.idevento = idevento
        modelo.idusuario = idusuario
        Dim dao As New ReservaDAO
        Return dao.insertar(modelo)
    End Function


    Public Function buscarPorFecha_reserva(ByVal fecha_reserva As String) As Collection
        Dim dao As New ReservaDAO
        Return dao.buscarPorFecha_reserva(fecha_reserva)
    End Function


    Public Sub eliminar(ByVal idreserva As Integer)
        Dim dao As New ReservaDAO
        dao.eliminar(idreserva)
    End Sub

    Public Function obtener(ByVal idreserva As Integer) As Reserva
        Dim dao As New ReservaDAO
        Return dao.obtener(idreserva)
    End Function

    Public Sub actualizar(ByVal idreserva As Integer, ByVal deporte As String, ByVal cantidad As String, ByVal fecha_reserva As String, ByVal idevento As Integer, ByVal idusuario As Integer)

        Dim modelo As New Reserva()
        modelo.idreserva = idreserva
        modelo.deporte = deporte
        modelo.cantidad = cantidad
        modelo.fecha_reserva = fecha_reserva
        modelo.idevento = idevento
        modelo.idusuario = idusuario

        Dim dao As New ReservaDAO
        dao.actualizar(modelo)
    End Sub

End Class
